#include <Arduino.h>

// put function declarations here:

int led_red = 12;
int led_yellow = 11;
int led_green = 10;

int btn_red = 5;
int btn_yellow = 4;
int btn_green = 3;
int btn_reset = 2;

void check_btn_press(int btn_pin, int led_pin);

void setup()
{
  // put your setup code here, to run once:
  pinMode(led_red, OUTPUT);
  pinMode(led_yellow, OUTPUT);
  pinMode(led_green, OUTPUT);

  pinMode(btn_red, INPUT);
  pinMode(btn_yellow, INPUT);
  pinMode(btn_green, INPUT);
  pinMode(btn_reset, INPUT);
}

void loop()
{
  // put your main code here, to run repeatedly:
  check_btn_press(btn_red,led_red);
  check_btn_press(btn_yellow,led_yellow);
  check_btn_press(btn_green,led_green);
}

// put function definitions here:
void check_btn_press(int btn_pin, int led_pin)
{
  int btn_pin_state = digitalRead(btn_pin);
  if (btn_pin_state == HIGH)
  {
    while (true)
    {
      int btn_reset_state = digitalRead(btn_reset);
      if (btn_reset_state == HIGH)
      {
        digitalWrite(led_pin, LOW);
        break;
      }
      else
      {
        digitalWrite(led_pin, HIGH);
      }
    }
  }
}